﻿using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
#pragma warning disable CS1591
namespace Core.SimpleTemp.Api.Swagger
{
    /// <summary>
    /// 
    /// </summary>
    public static class SwaggerApplicationBuilderExtensions
    {


        /// <summary>
        /// Swagger注册
        /// </summary>
        /// <param name="app"></param>
        /// <param name="env"></param>
        public static void UseSwagger(this IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment() || env.IsStaging())
            {
                app.UseSwagger();
                app.UseSwaggerUI(c =>
                {
                    c.SwaggerEndpoint("/swagger/Sys/swagger.json", "Sys基础信息");
                    c.SwaggerEndpoint("/swagger/Mobile/swagger.json", "Mobile Api");
                    c.SwaggerEndpoint("/swagger/YH/swagger.json", "YH隐患管理");
                    if (env.IsStaging())
                        c.RoutePrefix = "stagingswagger";
                    else
                        c.RoutePrefix = "devswagger";
                });
            }
        }

    }
}
